package com.yanqu.road.server.cmd.beautyescort;

import com.yanqu.road.pb.beautyescort.BeautyEscortProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.beautyescort.CrossBeautyEscortMgr;
import com.yanqu.road.server.manager.beautyescort.CrossEscortPlayerWrap;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.C_BEAUTY_ESCORT_ROAD_MAP, desc = "押镖路线")
public class CrossBeautyEscortRoadMapCmd extends CrossCommand {

    int type;
    String unionUid;
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        BeautyEscortProto.CrossBeautyEscortRoadMapReqMsg reqMsg = BeautyEscortProto.CrossBeautyEscortRoadMapReqMsg.parseFrom(packet.getBytes());
        type = reqMsg.getType();
        unionUid = reqMsg.getUnionUid();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        CrossEscortPlayerWrap escortPlayer = CrossBeautyEscortMgr.getEscortPlayer(serverId, packet.getPlayerId());
        if(escortPlayer != null){
            escortPlayer.roadMap(type, unionUid);
        }
    }

    @Override
    public void sendData() {

    }
}
